<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page deferredSyntaxAllowedAsLiteral="true" %>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <base href="${pageContext.request.contextPath}/"/>
    <link rel="stylesheet" type="text/css" href="./Css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="./Css/bootstrap-responsive.css"/>
    <link rel="stylesheet" type="text/css" href="./Css/style.css"/>
    <script type="text/javascript" src="./Js/jquery.js"></script>
    <script type="text/javascript" src="./Js/bootstrap.js"></script>
    <script type="text/javascript" src="./Js/ckform.js"></script>
    <script type="text/javascript" src="./Js/common.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }

        .option-button:hover {
            color: red;
        }

    </style>
</head>
<body>
<table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th>id</th>
        <th>权限名称</th>
        <%--        <th>描述</th>--%>
        <%--        <th>备注</th>--%>
        <th>操作</th>
    </tr>
    </thead>
    <c:forEach items="${pageEnd.rows}" var="role">
        <tr>
            <td>${role.username}</td>
            <td><c:choose>
                <c:when test="${role.level == 1}">
                    超级管理员
                </c:when>
                <c:when test="${role.level == 2}">
                    权限管理员
                </c:when>
                <c:when test="${role.level == 3}">
                    菜单管理员
                </c:when>
                <c:when test="${role.level == 4}">
                    数据管理员
                </c:when>
                <c:when test="${role.level == 5}">
                    普通管理员
                </c:when>
                <c:otherwise>
                    默认
                </c:otherwise>
            </c:choose>
            </td>
                <%--            <td>测试内容</td>--%>
                <%--            <td>无</td>--%>
            <td>
                <a class="option-button" href="/role/roleEdit?id=${role.id}">修改权限</a>
            </td>
        </tr>
    </c:forEach>
</table>
<div class="inline pull-right page">
    ${pageEnd.total}条记录 ${pageEnd.currentPage}/ ${pageEnd.totalPage}页
    <c:if test="${pageEnd.currentPage!=1}">
        <a href='/role/search?currentPage=1&pageSize=15'>首页</a>
    </c:if>
    <c:if test="${pageEnd.currentPage!=1}">
        <a href='/role/search?currentPage=${pageEnd.currentPage-1}&pageSize=15'>上一页</a>
    </c:if>
    <c:if test="${pageEnd.currentPage!=pageEnd.totalPage}">
        <a href='/role/search?currentPage=${pageEnd.currentPage+1}&pageSize=15'>下一页</a>
    </c:if>
    <c:if test="${pageEnd.currentPage!=pageEnd.totalPage}">
        <a href='/role/search?currentPage=${pageEnd.totalPage}&pageSize=15'>尾页</a>
    </c:if>
</div>
</body>
</html>
<script type="text/javascript">
    $("#addnew").click(function () {
        window.location.href = "/role/addRole";
    })
</script>